package com.example.charlotte.snakegame;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;

import java.util.Random;


public class Food {
    private int x;
    private int y;
    private Random random;
    public static final int WIDTH=20;

    public Food() {
        random = new Random();
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void draw(Canvas canvas, Paint paint){
        paint.setColor(Color.DKGRAY);
        canvas.drawRect(x,y,x+WIDTH,y+WIDTH,paint);
        paint.setColor(Color.RED);
        canvas.drawRect(x,y,x+WIDTH-5,y+WIDTH-5,paint);
    }

    public void reset(){
        x=random.nextInt(35-1)*WIDTH+WIDTH*1;
        y=random.nextInt(47-4)*WIDTH+WIDTH*4;
    }
}
